FROM registry.kdlq.net/jenkins:basic-2.10.0

ARG user=jenkins
ARG JENKINS_VERSION
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.289.2}

# jenkins.war checksum, download will be validated using it
ARG JENKINS_SHA

# Can be used to customize where jenkins.war get downloaded from
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
#ARG JENKINS_URL=https://updates.jenkins.io/download/war/${JENKINS_VERSION}/jenkins.war

# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
# see https://github.com/docker/docker/issues/8331
RUN curl -SsfL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war
RUN echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha256sum -c -

USER ${user}
